'''
Created on Apr 1, 2012

@author: Johnathon
'''
import One, Zero, sys

X = sys.modules[globals()['__name__']]


def AND(other):
        if not other.isLineValue():
            raise Exception("Tried to 'AND' something that isn't a subclass of LineValue")
        if other is Zero:
            return Zero
        else:
            return X
    
def OR(other):
        if not other.isLineValue():
            raise Exception("Tried to 'OR' something that isn't a subclass of LineValue")
        if other is One:
            return One
        else:
            return X
        
def XOR(other):
        if not other.isLineValue():
            raise Exception("Tried to 'XOR' something that isn't a subclass of LineValue")
        return X
    
def NOT():
    return X
    
def isLineValue():
    return True

def __repr__():
    return "X"

def __str__():
    return "X"
    
